<!-- inc:head -->
<script type="text/javascript">
function set_status(id,obj)
{
	var url = get_url("system","status") + '&id='+id;
	$.ajax({
		'url':url,
		'dataType':'json',
		'cache':false,
		'async':true,
		'beforeSend': function (XMLHttpRequest){
			XMLHttpRequest.setRequestHeader("request_type","ajax");
		},
		'success':function(rs){
			if(!rs.content){
				rs.content = '0';
			}
			var oldvalue = $(obj).val();
			if(oldvalue == '禁用'){
				$(obj).val('启用');
			}else{
				$(obj).val('禁用');
			}
		}
	});
}
function delete_sysmenu(id,title)
{
	$.dialog.confirm("确定要删除导航：<span class='red'>"+title+"</span>，删除后是不能恢复的！",function(){
		var url = get_url('system','delete','id='+id);
		var rs = json_ajax(url);
		if(rs.status != 'ok')
		{
			$.dialog.alert(rs.content);
			return false;
		}
		window.location.reload();
	});
}
function update_taxis(val,id)
{
	$.ajax({
		'url':get_url('system','taxis','taxis['+id+']='+val),
		'dataType':'json',
		'cache':false,
		'async':true,
		'beforeSend': function (XMLHttpRequest){
			XMLHttpRequest.setRequestHeader("request_type","ajax");
		},
		'success':function(rs){
			if(rs.status == 'ok'){
				$("div[data="+id+"]").html(val);
				//$.phpok.reload();
			}else{
				$.dialog.alert(rs.content);
				return false;
			}
		}
	});
}
$(document).ready(function(){
	$("div[name=taxis]").click(function(){
		var oldval = $(this).text();
		var id = $(this).attr('data');
		$.dialog.prompt('{lang请填写新的排序：}',function(val){
			if(val != oldval){
				update_taxis(val,id);
			}
		},oldval);
	});
});
</script>
<div class="tips">
	您当前的位置：
	<a href="{echo admin_url('system')}">核心配置</a>
	&raquo; 后台菜单列表
</div>
<div class="list2">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
	<th class="lft">&nbsp;名称</th>
	<th class="lft">&nbsp;控制器</th>
	<th width="60">状态</th>
	<th width="70">桌面显示</th>
	<th width="65">排序</th>
	<th width="135" class="lft">操作</th>
</tr>
<!-- run:$tab_i = 0; -->
<!-- foreach($rslist AS $key=>$value) -->
<!-- run:$tab_i++ -->
	<tr class="list">
		<td>&nbsp;{$value.title}</td>
		<td>&nbsp;</td>
		<td class="center">
			<input type="button" value="{$value.status ? '启用' : '禁用'}" class="phpok-btn" onclick="set_status({$value.id},this)" />
		</td>
		<td>&nbsp;</td>
		<td class="center"><div class="gray i hand center" title="{lang点击调整排序}" name="taxis" data="{$value.id}">{$value.taxis}</div></td>
		<td>
			<div class="button-group">
			<input type="button" value="{lang编辑}" onclick="$.phpok.go('{url ctrl=system func=set id=$value.id/}')" class="phpok-btn" />
			<input type="button" value="{lang添加子项}" onclick="$.phpok.go('{url ctrl=system func=set pid=$value.id/}')" class="phpok-btn" />
			</div>
		</td>
	</tr>
	<!-- foreach($value.sublist AS $k=>$v) -->
	<!-- run:$tab_i++ -->
	<tr class="sub">
		<td><div class="pleft">{$v.title}</div></td>
		<td>&nbsp;framework/admin/{$v.appfile}_control.php</td>
		<td class="center"><input type="button" value="{$v.status ? '启用' : '禁用'}" class="phpok-btn" onclick="set_status({$v.id},this)" /></td>
		<td align="center"><input type="button" class="phpok-btn" value="{if $v.icon}{lang显示}{else}{lang隐藏}{/if}" style="cursor:default;" /></td>
		<td class="center"><div class="gray i hand center" title="{lang点击调整排序}" name="taxis" data="{$v.id}">{$v.taxis}</div></td>
		<td>
			<div class="button-group">
				<input type="button" value="{lang编辑}" onclick="$.phpok.go('{url ctrl=system func=set id=$v.id/}')" class="phpok-btn" />
				<input type="button" value="{lang删除}" onclick="delete_sysmenu('{$v.id}','{$v.title}')" class="phpok-btn" />
			</div>
		</td>
	</tr>
	<!-- /foreach -->
<!-- /foreach -->
</table>
</div>
<!-- inc:foot -->
